nodejs18.x/s3/{{cookiecutter.project_name}}/template.yaml (45 lines of code) (raw):
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
{{cookiecutter.project_name}}
Parameters:
AppBucketName:
Type: String
Description: "REQUIRED: Unique S3 bucket name to use for the app."
Resources:
S3JsonLoggerFunction:
Type: AWS::Serverless::Function
Properties:
Handler: src/handlers/s3-json-logger.s3JsonLoggerHandler
Runtime: nodejs18.x
{%- if cookiecutter.architectures.value != []%}
Architectures:
{%- for arch in cookiecutter.architectures.value %}
- {{arch}}
{%- endfor %}
{%- endif %}
MemorySize: 128
Timeout: 60
Policies:
S3ReadPolicy:
BucketName: !Ref AppBucketName
Events:
S3NewObjectEvent:
Type: S3
Properties:
Bucket: !Ref AppBucket
Events: s3:ObjectCreated:*
Filter:
S3Key:
Rules:
- Name: suffix
Value: ".json"
AppBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: !Ref AppBucketName
BucketEncryption:
ServerSideEncryptionConfiguration:
- BucketKeyEnabled: true
VersioningConfiguration:
Status: Enabled